﻿using System;
using System.Windows;
using System.Windows.Input;

namespace DiagramDesigner
{
    /// <summary>
    /// Interaction logic for AddMeasure.xaml
    /// </summary>
    public partial class AddMeasure : Window
    {
        private int esPrimaryKey;
        public int EsPrimaryKey
        {
            get { return esPrimaryKey; }
            set { esPrimaryKey = value; }
        }
        
        private int tipoTemporalSpatial;
        public int TipoTemporalSpatial
        {
            get { return tipoTemporalSpatial; }
            set { tipoTemporalSpatial = value; }
        }

        private string strNewMeasure;
        private string strEstado = string.Empty;

        public string Estado
        {
            get { return strEstado; }
            set { strEstado = value; }
        }

        public string NewMeasure
        {
            get { return strNewMeasure; }
            set { strNewMeasure = value; }
        }


        public AddMeasure()
        {
            InitializeComponent();

            //cboNivelTemporalSpatial.SelectedIndex = 0;
        }

        private void AddProduct_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;// cbProducts.SelectedItem != null && !string.IsNullOrEmpty(tbQty.Text);
            e.Handled = true;
        }

        private void AddProduct_Executed(object sender, ExecutedRoutedEventArgs e)
        {
           
        }

        private void DeleteProduct_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
            e.Handled = true;
        }

        private void DeleteProduct_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            
        }

        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtMeasure.Text != string.Empty)
            {
                NewMeasure = txtMeasure.Text;
                TipoTemporalSpatial = chkTemporal.IsChecked == true ? 1 : 0;
                EsPrimaryKey = chkKey.IsChecked==true ? 1 : 0;
                Estado = "A";
                this.Close();
            }

        }

        private void Window_Closed(object sender, EventArgs e)
        {
            //txtMeasure.Text = string.Empty;
            //Estado = "C";
            //this.Close();
        }
    }
}
